const {readFile}=require("fs");
const eventEmitter=require("events");

class EE extends eventEmitter {}

const yy=new EE();
yy.on('event',()=>{
    console.log("出大事")
})

setTimeout(()=>{
    console.log("0毫秒到起执行的定时器回调")
},0)

setTimeout(()=>{
    console.log("0毫秒到起执行的定时器回调")
},100)

setTimeout(()=>{
    console.log("0毫秒到起执行的定时器回调")
},200)

readFile("../package.json","utf-8",data=>{
    console.log("完成文件1读操作")
})

readFile("../README.md","utf-8",data=>{
    console.log("完成文件2读操作")
})

setImmediate(()=>{
    console.log("立即回调")
})

process.nextTick(()=>{
    console.log("next回调")
})

Promise.resolve().then(()=>{
    yy.emit("event")
    process.nextTick(()=>{
        console.log("process.nextTick的第二次回调")
    })
    console.log("Promise第一次回调")
}).then(()=>{
    console.log("Promise第二次回调")
})